﻿@model SuperDumpService.ViewModels.ReportViewModel

<div class="panel panel-primary">
	<div class="panel-heading">
		<h4 class="panel-title">
			<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#modules">
				<span class="fa fa-plus"></span> Modules
			</a>
		</h4>
	</div>
	<div id="modules" class="panel-collapse in">
		<div class="panel-body">
			<table class="table table-condensed">
				<thead>
					<tr>
						<th>Name</th>
						<th>Size</th>
						<th>Version</th>
						@if (Model.DumpType == SuperDumpService.Models.DumpType.LinuxCoreDump) {
							<th>Start Address</th>
							<th>End Address</th>
							<th>Binding Offset</th>
						}
					</tr>
				</thead>
				<tbody>
					@if (Model.Result.SystemContext != null) {
						@foreach (var module in Model.Result.SystemContext.Modules.OrderBy(x => x.FilePath)) {
							<tr>
								@if (module is SuperDump.Models.SDCDModule) {
									<td style="width:50%;">@module.FilePath @Html.Partial("Tags", @module.Tags)</td>
									<td class="text-nowrap">@Model.SizeSuffix(module.FileSize)</td>
									<td class="text-nowrap">@module.Version</td>

									<td class="text-nowrap">@string.Format("0x{0:X}", ((SuperDump.Models.SDCDModule)module).StartAddress)</td>
									<td class="text-nowrap">@string.Format("0x{0:X}", ((SuperDump.Models.SDCDModule)module).EndAddress)</td>
									<td class="text-nowrap">@string.Format("0x{0:X}", ((SuperDump.Models.SDCDModule)module).Offset)</td>
								} else {
									<td style="width:70%;">@module.FilePath @Html.Partial("Tags", @module.Tags)</td>
									<td class="text-nowrap">@Model.SizeSuffix(module.FileSize)</td>
									<td class="text-nowrap">@module.Version</td>
								}
							</tr>
						}
					}
				</tbody>
			</table>
		</div>
	</div>
</div>